﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SmartWarehouse.BussinessLogic.Basis;
using SmartWarehouse.ORM.Entity;

public partial class ShipmentList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        TransactionFacade transFacade = new TransactionFacade();
        DataTable dtShipments = transFacade.GetShipmentList(this.txtName.Text.Trim(), txtStartDate.Text, txtEndDate.Text);

        gvShipments.DataSource = dtShipments;
        gvShipments.DataBind();
    }
    protected void gvShipments_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        MovementTypeFacade mvtFacade = new MovementTypeFacade();

        //Display movement desc instead of movement name
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int idxMovementName = 5;
            string movementName = e.Row.Cells[idxMovementName].Text;

            SwMovementType mvtType = mvtFacade.GetMovementTypeByName(movementName);
            e.Row.Cells[idxMovementName].Text = mvtType.Desc;
        }
    }
}
